package com.cat.controller;


import com.cat.entity.Persion;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.*;

@Controller
public class HelloController {


    @RequestMapping("/")
    public String indexHtml(){
        return "index";
    }
//    @RequestMapping("/")
//    public String index(){
//
//        return "index";
//    }

    @RequestMapping("/hello")
    @ResponseBody
    public String sayHello(){
        return "say hello!";
    }




    @RequestMapping("/thymeleaf")
    public String putThymeleaf(Map<String,Object> map){
        map.put("hello","你好");
        List<Persion> persionList = new ArrayList<>();
        Persion persion = new Persion();
        persion.setName("lisi");
        persion.setAge("1111");
        persion.setSex("123455656");
        persionList.add(persion);
        Persion persion1 = new Persion();
        persion1.setName("lisi");
        persion1.setAge("1111");
        persion1.setSex("123455656");
        persionList.add(persion1);
        Persion persion2 = new Persion();
        persion2.setName("lisi");
        persion2.setAge("1111");
        persion2.setSex("123455656");
        persionList.add(persion2);
        map.put("persionlist", persionList);
        return "sucess";
    }


}
